<template>
  <page-container>
    <a-card>
      <public-page-search
        @page-search-change="pageSearchChange"
        filter="trustFlag"
      ></public-page-search>
      <a-row :gutter="20" style="margin-top: 15px">
        <a-col>
          选择迭代次数:
          <a-select
            v-model:value="iterations"
            style="width: 220px"
            @focus="focus"
            ref="select"
            @change="handleChange"
          >
            <a-select-option value="jack">第一轮算法模型迭代结果</a-select-option>
            <a-select-option value="lucy">第二轮算法模型迭代结果</a-select-option>
            <a-select-option value="Yiminghe">第三轮算法模型迭代结果</a-select-option>
          </a-select>
        </a-col>
        <a-col>
          置信度筛选：
          <a-radio-group v-model:value="trustNum" @change="handleSizeChange">
            <a-radio-button value="<">
              <left-outlined />
              0.9
            </a-radio-button>
            <a-radio-button value=">">
              <right-outlined />
              =0.9
            </a-radio-button>
          </a-radio-group>
        </a-col>
      </a-row>
    </a-card>
    <a-card>
      <list portionUrl="/aitype/caseInfo/queryTrustInfo" :params="queryForm" />
    </a-card>
  </page-container>
</template>

<script lang="ts">
import { defineComponent, reactive, ref } from 'vue';
import { LeftOutlined } from '@ant-design/icons-vue';
import { RightOutlined } from '@ant-design/icons-vue';
import PublicPageSearch from '@/views/intelligent-analysis/components/public-page-search/index.vue';
import list from './components/checkList.vue';
import { PublicQueryState } from '@/views/intelligent-analysis/typing';
import { getInitParams } from '@/views/intelligent-analysis/js/publicQuery';
import { omit } from 'lodash';

export default defineComponent({
  components: { LeftOutlined, list, RightOutlined, PublicPageSearch },
  setup() {
    const trustNum = ref<any>('<');
    const iterations = ref<any>('Yiminghe');
    const publicParams = omit(getInitParams(), ['searchType']);
    const queryForm: PublicQueryState = reactive({
      ...publicParams,
      trustNum: '<',
    });

    const query = ref<any>({
      inputParams: '',
      trustNum: trustNum.value,
    });
    //查询
    const handleQuery = () => {
      queryForm.trustNum = query.value.trustNum;
      queryForm.inputParams = query.value.inputParams;
    };

    const pageSearchChange = params => {
      Object.keys(queryForm).forEach(key => {
        Object.prototype.hasOwnProperty.call(params, key) && (queryForm[key] = params[key]);
      });
    };
    const handleSizeChange = e => {
      trustNum.value = e.target.value;
      queryForm.trustNum = trustNum.value;
    };

    return {
      query,
      queryForm,
      handleQuery,
      trustNum,
      iterations,
      handleSizeChange,
      pageSearchChange,
    };
  },
});
</script>

<style scoped></style>
